package com.atguigu.admin.actuator.endpoint;

import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;

/**
 * @author ：malichun
 * @date 2022/2/20 7:20 PM
 * @description：
 * @modified By：
 */
@Component
@Endpoint(id="myservice")
public class MyServiceEndpoint {

    @ReadOperation
    public Map getDockerInfo(){ // 一定不能有参数
        return Collections.singletonMap("dokcerInfo","docker started");
    }

    @WriteOperation
    public void stopDocker(){
        System.out.println("docker stoped......");
    }

}
